<?php

class Back_TicketsController extends Zend_Controller_Action
{
    public function init() {
        $this->_helper->layout->setLayout('admin');
    }
    public function index() {
        
    }
    /**
     * Выборка всех тем сообщений 
     */
    public function allmessagesAction() {
        $obj = new Back_Model_Tickets();
        $allthemepub = $obj->getAllThemePublisher();
        $allthemeadv = $obj->getAllThemeAdvertiser();
        $alltheme = array_merge($allthemepub, $allthemeadv);
        var_dump($alltheme);
        $this->view->alltheme = $alltheme;
    }
    
    public function newmessageAction() {
        
    }
    
    public function messagesAction() {
        $obj = new Back_Model_Tickets();
        $id_theme = $this->_getParam('id');
        $key = $this->_getParam('key');
        if($key == 'pub'){
        $messages = $obj->getAllMessagePublisher($id_theme);
        } elseif($key == 'adv') {
            $messages = $obj->getAllMessageAdvertiser($id_theme);
        }
        $this->view->messages = $messages;
    }
}
?>
